<%@page import="java.lang.Math.*" %>
<%@page import="Connectdata.connectdatabase" %>
<%@page import="java.text.DecimalFormat"%>
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%
 
                    connectdatabase con_checklogin = new connectdatabase();
                    con_checklogin.connect();
                    con_checklogin.connectstring("select * from UserAccount where isActive=1 and CAST(UserName AS VARBINARY(255)) = CAST(N'"+request.getParameter("myusername")+"' AS VARBINARY(255)) and CAST(Password AS VARBINARY(255))  = CAST(N'"+request.getParameter("mypassword")+"'AS VARBINARY(255))");
                    if(con_checklogin.rs_connect.next())
                        {
                        session.setAttribute("success", "success");
                        session.setAttribute("username", request.getParameter("myusername"));
                        if(session.getAttribute("username").equals("admin"))
                            {
                        %>
                        <c:redirect url="Admin.jsp"/>
<%
}
                        else {
                            %> <c:redirect url="index.jsp"/><%
                            }
                        }
                    else
                        {
                        %>
                        <c:redirect url="login.jsp"/>
                        <%
                        }
                  con_checklogin.rs_connect.close();con_checklogin.con_connect.close();con_checklogin.s_connect.close();
                %>
